#include "dsp.h"
static unsigned char seg_com = 0;
unsigned char dot_com1 = 255;
unsigned char dot_com2 = 255;
unsigned char buffer[8] = {0};
code unsigned char seg_buffer[20] = {0xc0,0xf9,0xa4,0xb0,\
0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,\
0xff,0xbf,0x8c,0x8e};

void seg_display(void)
{
	SEG(0xff);
	COM(1<<seg_com);
	if(seg_com == dot_com1)
	{
		SEG(seg_buffer[buffer[seg_com]]&0x7f);
	}
	else if(seg_com == dot_com2)
	{
		SEG(seg_buffer[buffer[seg_com]]&0x7f);
	}
	else
	{
		SEG(seg_buffer[buffer[seg_com]]);
	}
	
	if(++seg_com >= 8)
	{
		seg_com = 0;
	}
}